package cn.mazexal.exambg.controller;

import cn.mazexal.exambg.common.models.MultiResponse;
import cn.mazexal.exambg.common.models.PagedResponse;
import cn.mazexal.exambg.common.models.SingleResponse;
import cn.mazexal.exambg.models.qry.IDQry;
import cn.mazexal.exambg.models.qry.OrderQry;
import cn.mazexal.exambg.models.vo.FinOrderVO;
import cn.mazexal.exambg.models.vo.VipPriceGroupVO;
import cn.mazexal.exambg.models.vo.VipPriceVO;
import cn.mazexal.exambg.services.OrderService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Mazexal
 * Date: 2025/6/29
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private OrderService orderService;

    @PostMapping("/getVipPriceList")
    public MultiResponse<VipPriceVO> getVipPriceList(@RequestBody IDQry qry){
        return MultiResponse.of(orderService.getVipPriceList(qry.getId()));
    }

    @PostMapping("/addVipPrice")
    public SingleResponse<Boolean> addVipPrice(@RequestBody VipPriceVO vipPriceVO){
        return SingleResponse.of(orderService.addVipPrice(vipPriceVO));
    }

    @PostMapping("/updateVipPrice")
    public SingleResponse<Boolean> updateVipPrice(@RequestBody VipPriceVO vipPriceVO){
        return SingleResponse.of(orderService.updateVipPrice(vipPriceVO));
    }

    @PostMapping("/getVipPriceGroup")
    public MultiResponse<VipPriceGroupVO> getVipPriceGroupList(){
        return MultiResponse.of(orderService.getVipPriceGroupList());
    }

    @PostMapping("/addVipPriceGroup")
    public SingleResponse<Boolean> addVipPriceGroup(@RequestBody VipPriceGroupVO vipPriceGroupVO){
        return SingleResponse.of(orderService.addVipPriceGroup(vipPriceGroupVO));
    }

    @PostMapping("/updateVipPriceGroup")
    public SingleResponse<Boolean> updateVipPriceGroup(@RequestBody VipPriceGroupVO vipPriceGroupVO){
        return SingleResponse.of(orderService.updateVipPriceGroup(vipPriceGroupVO));
    }

    @PostMapping("/getOrderList")
    public PagedResponse<FinOrderVO> getOrderList(@RequestBody OrderQry qry){
        return PagedResponse.of(orderService.getOrderList(qry));
    }
}
